package com.xayy.health.mgt.controller;

import cn.kawins.base.result.ResultBody;
import cn.kawins.mybatis.base.BaseController;
import com.xayy.health.mgt.model.SatelliteCode;
import com.xayy.health.mgt.service.SatelliteCodeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author Nie
 * @version V1.0
 * @date 2023/5/31 9:52
 */
@RestController
@RequestMapping(value = "/satelliteCode")
@Api(tags = "知识图谱卫星code与遥测卫星id关联关系")
public class SatelliteCodeController extends BaseController<SatelliteCode> {

    @Autowired
    private SatelliteCodeService satelliteCodeService;

    /**
     * 新增卫星关系
     *
     * @param satelliteCode 卫星信息入参
     * @return ResultBody
     */
    @ApiOperation(value = "新增卫星关系")
    @PostMapping("/insertSatelliteCode")
    public ResultBody insertSatelliteCode(@RequestBody SatelliteCode satelliteCode){
        return satelliteCodeService.insertSatelliteCode(satelliteCode).body();
    }

    /**
     * 删除卫星节点信息
     * @param id 卫星id
     * @return ResultBody
     */
    @ApiOperation(value = "删除卫星关系")
    @DeleteMapping("/deleteSatelliteCode")
    public ResultBody deleteSatelliteCode(@RequestParam Long id){
        return satelliteCodeService.deleteSatelliteCode(id).body();
    }

    /**
     * 修改卫星节点信息
     * @param satelliteCode  入参信息
     * @return ResultBody
     */
    @ApiOperation(value = "修改卫星关系")
    @PostMapping("/updateSatelliteCode")
    public ResultBody updateSatelliteCode(@RequestBody SatelliteCode satelliteCode){
        return satelliteCodeService.updateSatelliteCode(satelliteCode).body();
    }

    /**
     * 查询卫星节点信息
     * @return ResultBody
     */
    @ApiOperation(value = "查找卫星关系")
    @GetMapping("/selectSatelliteCode")
    public ResultBody selectSatelliteCode(){
        return satelliteCodeService.selectSatelliteCode().body();
    }

}
